# 其它模型分装在 langchain_community 底包中
from langchain_community.chat_models import QianfanChatEndpoint
from langchain_core.messages import HumanMessage
from dotenv import load_dotenv, find_dotenv
import os

# 加载 .env 到环境变量
_ = load_dotenv(find_dotenv())

# 没充钱
qianfan_ak = os.getenv('ERNIE_CLIENT_ID')
print(qianfan_ak)
qianfan_sk = os.getenv('ERNIE_CLIENT_SECRET')
print(qianfan_sk)

llm = QianfanChatEndpoint(
    qianfan_ak=qianfan_ak,
    qianfan_sk=qianfan_sk
)

messages = [
    HumanMessage(content="你是谁")
]

ret = llm.invoke(messages)

print(ret.content)
